package org.myproject.persistence;

import java.io.Serializable;
import java.sql.Connection;

import org.hibernate.CacheMode;
import org.hibernate.Criteria;
import org.hibernate.EntityMode;
import org.hibernate.Filter;
import org.hibernate.FlushMode;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.ReplicationMode;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.stat.SessionStatistics;

/**
 * Simple hibernate {@link Session} adapter
 * 
 * @author ivaynberg
 * 
 */
public abstract class AbstractSessionAdapter {
	protected abstract Session getSession();

	public Transaction beginTransaction() throws HibernateException {
		return getSession().beginTransaction();
	}

	public void cancelQuery() throws HibernateException {
		getSession().cancelQuery();
	}

	public void clear() {
		getSession().clear();
	}

	public Connection close() throws HibernateException {
		return getSession().close();
	}

	public Connection connection() throws HibernateException {
		return getSession().connection();
	}

	public boolean contains(Object object) {
		return getSession().contains(object);
	}

	public Criteria createCriteria(Class persistentClass, String alias) {
		return getSession().createCriteria(persistentClass, alias);
	}

	public Criteria createCriteria(Class persistentClass) {
		return getSession().createCriteria(persistentClass);
	}

	public Criteria createCriteria(String entityName, String alias) {
		return getSession().createCriteria(entityName, alias);
	}

	public Criteria createCriteria(String entityName) {
		return getSession().createCriteria(entityName);
	}

	public Query createFilter(Object collection, String queryString)
			throws HibernateException {
		return getSession().createFilter(collection, queryString);
	}

	public Query createQuery(String queryString) throws HibernateException {
		return getSession().createQuery(queryString);
	}

	public SQLQuery createSQLQuery(String queryString)
			throws HibernateException {
		return getSession().createSQLQuery(queryString);
	}

	public void delete(Object object) throws HibernateException {
		getSession().delete(object);
	}

	public void delete(String entityName, Object object)
			throws HibernateException {
		getSession().delete(entityName, object);
	}

	public void disableFilter(String filterName) {
		getSession().disableFilter(filterName);
	}

	public Connection disconnect() throws HibernateException {
		return getSession().disconnect();
	}

	public Filter enableFilter(String filterName) {
		return getSession().enableFilter(filterName);
	}

	public void evict(Object object) throws HibernateException {
		getSession().evict(object);
	}

	public void flush() throws HibernateException {
		getSession().flush();
	}

	public Object get(Class clazz, Serializable id, LockMode lockMode)
			throws HibernateException {
		return getSession().get(clazz, id, lockMode);
	}

	public Object get(Class clazz, Serializable id) throws HibernateException {
		return getSession().get(clazz, id);
	}

	public Object get(String entityName, Serializable id, LockMode lockMode)
			throws HibernateException {
		return getSession().get(entityName, id, lockMode);
	}

	public Object get(String entityName, Serializable id)
			throws HibernateException {
		return getSession().get(entityName, id);
	}

	public CacheMode getCacheMode() {
		return getSession().getCacheMode();
	}

	public LockMode getCurrentLockMode(Object object) throws HibernateException {
		return getSession().getCurrentLockMode(object);
	}

	public Filter getEnabledFilter(String filterName) {
		return getSession().getEnabledFilter(filterName);
	}

	public EntityMode getEntityMode() {
		return getSession().getEntityMode();
	}

	public String getEntityName(Object object) throws HibernateException {
		return getSession().getEntityName(object);
	}

	public FlushMode getFlushMode() {
		return getSession().getFlushMode();
	}

	public Serializable getIdentifier(Object object) throws HibernateException {
		return getSession().getIdentifier(object);
	}

	public Query getNamedQuery(String queryName) throws HibernateException {
		return getSession().getNamedQuery(queryName);
	}

	public Session getSession(EntityMode entityMode) {
		return getSession().getSession(entityMode);
	}

	public SessionFactory getSessionFactory() {
		return getSession().getSessionFactory();
	}

	public SessionStatistics getStatistics() {
		return getSession().getStatistics();
	}

	public Transaction getTransaction() {
		return getSession().getTransaction();
	}

	public boolean isConnected() {
		return getSession().isConnected();
	}

	public boolean isDirty() throws HibernateException {
		return getSession().isDirty();
	}

	public boolean isOpen() {
		return getSession().isOpen();
	}

	public Object load(Class theClass, Serializable id, LockMode lockMode)
			throws HibernateException {
		return getSession().load(theClass, id, lockMode);
	}

	public Object load(Class theClass, Serializable id)
			throws HibernateException {
		return getSession().load(theClass, id);
	}

	public void load(Object object, Serializable id) throws HibernateException {
		getSession().load(object, id);
	}

	public Object load(String entityName, Serializable id, LockMode lockMode)
			throws HibernateException {
		return getSession().load(entityName, id, lockMode);
	}

	public Object load(String entityName, Serializable id)
			throws HibernateException {
		return getSession().load(entityName, id);
	}

	public void lock(Object object, LockMode lockMode)
			throws HibernateException {
		getSession().lock(object, lockMode);
	}

	public void lock(String entityName, Object object, LockMode lockMode)
			throws HibernateException {
		getSession().lock(entityName, object, lockMode);
	}

	public Object merge(Object object) throws HibernateException {
		return getSession().merge(object);
	}

	public Object merge(String entityName, Object object)
			throws HibernateException {
		return getSession().merge(entityName, object);
	}

	public void persist(Object object) throws HibernateException {
		getSession().persist(object);
	}

	public void persist(String entityName, Object object)
			throws HibernateException {
		getSession().persist(entityName, object);
	}

	public void reconnect() throws HibernateException {
		getSession().reconnect();
	}

	public void reconnect(Connection connection) throws HibernateException {
		getSession().reconnect(connection);
	}

	public void refresh(Object object, LockMode lockMode)
			throws HibernateException {
		getSession().refresh(object, lockMode);
	}

	public void refresh(Object object) throws HibernateException {
		getSession().refresh(object);
	}

	public void replicate(Object object, ReplicationMode replicationMode)
			throws HibernateException {
		getSession().replicate(object, replicationMode);
	}

	public void replicate(String entityName, Object object,
			ReplicationMode replicationMode) throws HibernateException {
		getSession().replicate(entityName, object, replicationMode);
	}

	public Serializable save(Object object) throws HibernateException {
		return getSession().save(object);
	}

	public Serializable save(String entityName, Object object)
			throws HibernateException {
		return getSession().save(entityName, object);
	}

	public void saveOrUpdate(Object object) throws HibernateException {
		getSession().saveOrUpdate(object);
	}

	public void saveOrUpdate(String entityName, Object object)
			throws HibernateException {
		getSession().saveOrUpdate(entityName, object);
	}

	public void setCacheMode(CacheMode cacheMode) {
		getSession().setCacheMode(cacheMode);
	}

	public void setFlushMode(FlushMode flushMode) {
		getSession().setFlushMode(flushMode);
	}

	public void setReadOnly(Object entity, boolean readOnly) {
		getSession().setReadOnly(entity, readOnly);
	}

	public void update(Object object) throws HibernateException {
		getSession().update(object);
	}

	public void update(String entityName, Object object)
			throws HibernateException {
		getSession().update(entityName, object);
	}

}
